home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / listings / v_08_11 / 8n11086b < prev    next >
Text File  |  1990-09-16  |  249b  |  18 lines

  1.  
  2.     class Inc {
  3.     public:
  4.         Inc( int n = 0)        { val = n; }
  5.         void increment()    { val++; }
  6.     private:
  7.         friend void print( Inc);
  8.         int val;
  9.     };
  10.  
  11.     void print( Inc i) { printf( "%d ", i.val); }
  12.     
  13.     ...
  14.     Inc i(3);
  15.     i.increment();
  16.     print( i);
  17.  
  18.